package Operation;

import Account.*;

import java.util.Scanner;

public class AddAccountOperation extends IOperation{
    public AddAccountOperation() {
    }

    @Override
    public void work(Account account,AcountList acountList) {
        Scanner scanner = new Scanner(System.in);
        boolean ba = true;
        String id = "";
        String passworld = "";
        int money = 0;
        String str = "";
        while(ba){
            System.out.println("请输入姓名");
           str = scanner.next();

            System.out.println("请输入六位数账号");
            id = scanner.next();

            System.out.println("请输六位数入密码");
           passworld = scanner.next();

            System.out.println("存入的金额");
            money = scanner.nextInt();

            if(passworld.length()!=6||id.length()!=6){
                System.out.println("账号或者密码错误，请重新输入");
            }else{
                ba = false;
            }
        }

        acountList.setAccount(new Account(id,passworld,money,str));
    }
}
